Add systemd integration via a template unit#6
Conversation
|
Should we install the files too if we ship them? And how about dropping the sysv init script? I added it to yocto because sysv was the default at the time but I consider dropping it with systemd becoming the default. |
Did that. I didn't check if pyproject actually installs all the files though. I dropped the sysvinit script and set a default mountpoint of |
That's a question actually. If you can't test it (for instance: modify the yocto recipe to use it) then I'm fine with shipping them as an example and not installing them. |
I think the services get installed properly. I just checked this with: it shows: and I think those files woukd go into |
| ] | ||
| "lib/systemd/system/sysinit.target.wants" = [ | ||
| "share/sysinit.target.wants/run-gpio-sys.mount", | ||
| "share/sysinit.target.wants/sys-class.mount", |
There was a problem hiding this comment.
This installs these files unconditionally. In my meta-openembedded recipe I only do this if the user selected the - admittedly quite intrusive - sys-class-mount PACKAGECONFIG switch. Should we have a corresponding switch here as well?
There was a problem hiding this comment.
This installs these files unconditionally. In my meta-openembedded recipe I only do this if the user selected the - admittedly quite intrusive -
sys-class-mountPACKAGECONFIG switch. Should we have a corresponding switch here as well?
Not sure if we can have a switch here without a lot of fudging around - that's why I made the python package install the most useful default service by default.
Do we really need to support both paths? I don't know enough about this really, but I suspect it'd make sense to support one by default in distros like debian etc?
Perhaps it'd make sense to install using a default path and push users to README for information to use alternate paths? again, I am not entirely sure here, but surely for modern installs there is a sensibe default? :-)
There was a problem hiding this comment.
TBH I never really considered this could be packaged in Debian. :) Is mounting an overlay over /sys/class something Debian would accept as the default? Sounds quite risky to me.
There was a problem hiding this comment.
Seems fine to me, if you install this you kind of need it to work :-)
Alternatively in the python install we could install 2x systemd services (one for each path, or a template and 2x services extending the template) to a doc dir (e.g. not install them), then in yocto/debian we could install the script by default and have the services as as separate packages, and let users choose which package they want to install (and in yocto you can keep the same var, just install different services to the right place) ?
There was a problem hiding this comment.
Or (for yocto) possibly two mutually-exclusive packages: gpiod-sysfs-proxy-systemd-overlay and gpiod-sysfs-proxy-systemd-tmp with the former installing the /sys/class overlay units?
There was a problem hiding this comment.
exactly, and in this python installer i should put the service files into a documentation dir.
Need to figure out how to make the services extend another service so we don't duplicate code.
There was a problem hiding this comment.
Would it be too much to ask to also update the yocto recipe if you're doing it? :)
There was a problem hiding this comment.
@brgl I updated this PR based on the conversation above. I haven't tested the service files in yocto yet, as I said it's a bit obtuse for me to build the yocto recipe :-). Could you try the service and README instructions in the Yocto recipe please ?
There was a problem hiding this comment.
BTW, I think this is the final blocking PR to getting this pushed into Debian. I'd like to do that soonish :-)
Provide systemd support for mounting the gpiod-sysfs-proxy compatibility
filesystem.
The package now installs a single template unit, gpiod-sysfs-proxy@.service,
with an instance name of the systemd-escaped mountpoint (e.g.
gpiod-sysfs-proxy@run-gpio.service). No instance is enabled by default so
the admin opts into the mountpoint they want:
systemctl enable --now gpiod-sysfs-proxy@run-gpio.service
systemctl enable --now gpiod-sysfs-proxy@sys-class-gpio.service
Exposing /sys/class/gpio on a kernel where the sysfs GPIO interface is
disabled needs the missing 'gpio' directory overlaid onto /sys/class
first. The run-gpio-sys.mount and sys-class.mount units handle that and
an instance-specific drop-in pulls them in only for the sys-class-gpio
instance. PartOf= ties their lifetime to that instance for clean
teardown and ConditionPathExists=!/sys/class/gpio makes them no-ops
when the directory already exists. Other instances never touch the
overlay.
Fixes: brgl#6
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
eb4522e to
9629d3c
Compare
Provide systemd support for mounting the gpiod-sysfs-proxy compatibility
filesystem.
The package now installs a single template unit, gpiod-sysfs-proxy@.service,
with an instance name of the systemd-escaped mountpoint (e.g.
gpiod-sysfs-proxy@run-gpio.service). No instance is enabled by default so
the admin opts into the mountpoint they want:
systemctl enable --now gpiod-sysfs-proxy@run-gpio.service
systemctl enable --now gpiod-sysfs-proxy@sys-class-gpio.service
Exposing /sys/class/gpio on a kernel where the sysfs GPIO interface is
disabled needs the missing 'gpio' directory overlaid onto /sys/class
first. The run-gpio-sys.mount and sys-class.mount units handle that and
an instance-specific drop-in pulls them in only for the sys-class-gpio
instance. PartOf= ties their lifetime to that instance for clean
teardown and ConditionPathExists=!/sys/class/gpio makes them no-ops
when the directory already exists. Other instances never touch the
overlay.
Fixes: brgl#6
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
9629d3c to
bfb4e7b
Compare
Add the example systemd service files from the OpenEmbedded recipe[0].
The files are licenced under the same licence as the upstream project.
Link[0]: https://git.openembedded.org/meta-openembedded/tree/meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy
Fixes: #3